package cn.iocoder.yudao.module.dr.dal.mysql.collectionimageacquisition;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.dr.controller.admin.collectionimageacquisition.vo.CollectionImageAcquisitionPageReqVO;
import cn.iocoder.yudao.module.dr.dal.dataobject.collection3dacquisition.Collection3dAcquisitionDO;
import cn.iocoder.yudao.module.dr.dal.dataobject.collectionimageacquisition.CollectionImageAcquisitionDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 藏品二维采集信息 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface CollectionImageAcquisitionMapper extends BaseMapperX<CollectionImageAcquisitionDO> {

    default PageResult<CollectionImageAcquisitionDO> selectPage(CollectionImageAcquisitionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CollectionImageAcquisitionDO>()
                .eqIfPresent(CollectionImageAcquisitionDO::getCollectionId, reqVO.getCollectionId())
                .eqIfPresent(CollectionImageAcquisitionDO::getGeneralAccessionNumber, reqVO.getGeneralAccessionNumber())
                .likeIfPresent(CollectionImageAcquisitionDO::getImageFilename, reqVO.getImageFilename())
                .eqIfPresent(CollectionImageAcquisitionDO::getFileFormat, reqVO.getFileFormat())
                .betweenIfPresent(CollectionImageAcquisitionDO::getProcessingDate, reqVO.getProcessingDate())
                .eqIfPresent(CollectionImageAcquisitionDO::getProcessingUnit, reqVO.getProcessingUnit())
                .eqIfPresent(CollectionImageAcquisitionDO::getProcessor, reqVO.getProcessor())
                .eqIfPresent(CollectionImageAcquisitionDO::getQualityInspector, reqVO.getQualityInspector())
                .eqIfPresent(CollectionImageAcquisitionDO::getFileSize, reqVO.getFileSize())
                .eqIfPresent(CollectionImageAcquisitionDO::getResolution, reqVO.getResolution())
                .eqIfPresent(CollectionImageAcquisitionDO::getShootingUnit, reqVO.getShootingUnit())
                .eqIfPresent(CollectionImageAcquisitionDO::getShootingLocation, reqVO.getShootingLocation())
                .betweenIfPresent(CollectionImageAcquisitionDO::getShootingDate, reqVO.getShootingDate())
                .eqIfPresent(CollectionImageAcquisitionDO::getPhotographer, reqVO.getPhotographer())
                .eqIfPresent(CollectionImageAcquisitionDO::getEquipmentModel, reqVO.getEquipmentModel())
                .eqIfPresent(CollectionImageAcquisitionDO::getAcquisitionContent, reqVO.getAcquisitionContent())
                .eqIfPresent(CollectionImageAcquisitionDO::getTotalImages, reqVO.getTotalImages())
                .eqIfPresent(CollectionImageAcquisitionDO::getAcquisitionInspector, reqVO.getAcquisitionInspector())
                .betweenIfPresent(CollectionImageAcquisitionDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(CollectionImageAcquisitionDO::getSourceStatus,reqVO.getSourceStatus())
                .betweenIfPresent(CollectionImageAcquisitionDO::getSubmitAuditDate,reqVO.getSubmitAuditDate())
                .betweenIfPresent(CollectionImageAcquisitionDO::getCatalogDate,reqVO.getCatalogDate())
                .eqIfPresent(CollectionImageAcquisitionDO::getCataloger,reqVO.getCataloger())
                .eqIfPresent(CollectionImageAcquisitionDO::getAuditOpinion,reqVO.getAuditOpinion())
                .last("ORDER BY CONVERT(INTEGER, GENERAL_ACCESSION_NUMBER) ASC"));  // 达梦的 CONVERT 语法
    }

    public CollectionImageAcquisitionDO selectByImageFilename(@Param("collectionId")Long collectionId,@Param("imageFilename") String imageFilename);
}